﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FilterPattern
{
    public class AndFilter : Filter
    {
        private Filter filter;
        private Filter otherFilter;

        public AndFilter(Filter filter,Filter otherFilter)
        {
            this.filter = filter;
            this.otherFilter = otherFilter;
        }

        public List<Person> MeetFilter(List<Person> persons)
        {
            List<Person> firstFilterPersons = filter.MeetFilter(persons);
            return otherFilter.MeetFilter(firstFilterPersons);
        }
    }
}
